import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [vue()],
    server: {
        host: '0.0.0.0',
        port: 9999,//更改启动端口
        open: true,//自动打开网页
        // 反向代理
        proxy: {
            '/api': {
                target: 'http://172.27.0.110:6113',//代理的地址
                changeOrigin: true,
                pathRewrite: {
                    "^/api": "",
                },
            }
        },
    },
    chainWebpack: config => {
        config
            .plugin('html')
            .tap(args => {
                args[0].title = 'EVA vue3'
                return args
            })
    },
    build: {
        terserOptions: {
            compress: {
                drop_console: true
            }
        },
        outDir: 'dist', //指定输出路径
        assetsDir: 'assets' //指定生成静态资源的存放路径
    }
})
